#include "fanhighcommand.h"

#include <qDebug>

FanHighCommand::FanHighCommand(Fan *fan)
    : m_fan(fan)
{
}

void FanHighCommand::execute()
{
    m_preSpeed = m_fan->getSpeed();
    m_fan->setHigh();
}

void FanHighCommand::undo()
{
    switch (m_preSpeed)
    {
    case 3:
        m_fan->setHigh();
        break;
    case 2:
        m_fan->setMedium();
        break;
    case 1:
        m_fan->setLow();
        break;
    case 0:
        m_fan->setOff();
        break;
    default:
        break;
    }
}
